package net.lgy.enums;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;



//分享链接的日期类型
@Getter
@AllArgsConstructor
public enum ShareDateEnum {

    PERMANENT(0, 0),
    ONE_DAY(1, 1),
    ONE_WEEK(2, 7),
    ONE_MONTH(3, 30);

    private  Integer dayType;

    private Integer days;
//    根据类型获取有效天数
    public static Integer getDaysByType(Integer type) {
        for (ShareDateEnum value : ShareDateEnum.values()) {
            if (value.dayType.equals(type)) {
                return value.days;
            }
        }
//        默认七天
        return ONE_WEEK.getDays();
    }
}
